<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="ZH-CN">
<c:choose>
  <c:when test="${student_name }==null">
    <c:redirect url="/LWGL"></c:redirect>
  </c:when>
</c:choose>
<head>
<title>学生选题</title>
<meta http-equiv="X-UA-Compatible" content="IE=9" >
<meta name="keywords" content="吉珠,吉林大学,吉林大学珠海学院,吉林大学珠海学院论文管理">
<meta name="content-type" content="text/html" charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href=".//css/bootstrap.css" type="text/css">
<script src=".//js/jquery-2.1.1.js" type="text/javascript"></script>
<script src=".//js/bootstrap.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/jquery-easyui-1.4.1/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/jquery-easyui-1.4.1/themes/gray/easyui.css" type="text/css"></link>
<link rel="stylesheet" href="<%=request.getContextPath()%>/jquery-easyui-1.4.1/themes/icon.css" type="text/css"></link>
<script type="text/javascript" src="<%=request.getContextPath()%>/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>

<script type="text/javascript" language="javascript">
function g(o){return document.getElementById(o);}
function hoverli(n){
for(var i=1;i<=19;i++){
{g('tb_'+i).className='';}
g('tb_'+n).className='actived';}
}

function check_xuanti(){confirm("你是否确认选择该论文选题？");   }

//后台人员代码-----开始--------------------------------------------------

var stuDis;
	var stuOwnDis;
	$(function() {
	$('#dlg').window({
    width:400,
    height:100,
    modal:true,
    closed:true
    });

		stuDis = $('#stuDis').datagrid({
			url : '<%=request.getContextPath()%>/stuGetDisInfos',
			title : '论文选题',
			striped:true,
		    nowrap:false,
			pagination : true,
			singleSelect : true,
			rownumbers: true,
			fit : true,
			columns : [ [ {
				field : 'thesistitle_name',
				title : '论文题目',
				width : '30%',
			}, {
				field : 'thesistitle_type',
				title : '论文类型',
				width : '10%',
			}, {
				field : 'thesissource_name',
				title : '来源',
				width : '30%',
			}, {
				field : 'thesistitle_selected',
				title : '论文选择状态',
				width : '14%',
					formatter : function(value, row, index) {
				if(value=="A")
				     return "<font color='#FF8800'><label>已被选</label></font>";
					if(value=="B")
				     return "<font color='#00FF00'><label>未被选</label></font>";
				     else
				     return  "<label>"+value+"</label>";
				}
			    
			}, {
				field : 'radio',
				title : '勾选',
				editable  :false,
				width : '15%',
				//checkbox: true,
				formatter : function(value, row, index) {
				if(row.thesistitle_selected=="A")
				     return "<font color='#F00'><label>不可选</label></font>";
					return "<a onclick=select('+index+')>选定</a>";
				}
			} ] ],
		
			
		});
		

		stuOwnDis = $('#stuOwnDis').datagrid({
			url : '<%=request.getContextPath()%>/getOwnDis',
			title : '已提交论文选题',
			striped:true,
		    nowrap:false,
			 cache: false,
			fit : true,
			fitColumns : true,
			columns : [ [ {
				field : 'thesistitle_name',
				title : '论文题目',
				width : 150,
			}, {
				field : 'thesistitle_type',
				title : '论文类型',
				width : 100
			}, {
				field : 'thesissource_name',
				title : '来源',
				width : 100
			}, {
				field : 'thesistitle_checkstate',
				title : '论文审核状态',
				width : 100,
					formatter : function(value, row, index) {
				if(row.thesistitle_checkstate=='A')
				     return "<font color='#FF7F00'><label>未审核</label></font>";
				if(row.thesistitle_checkstate=='B')
				 return "<font color='#FF8800'><label>指导教师审核未通过</label></font>";
				 if(row.thesistitle_checkstate=='C')
				 return "<font color='#33FF33'><label>指导教师审核通过</label></font>";
				 if(row.thesistitle_checkstate=='D')
				 return "<font color='#33FF33'><label>修改通过</label></font>";
				 if(row.thesistitle_checkstate=='E')
				 return "<font color='#FF8800'><label>专业负责人审核未通过</label></font>";
				 if(row.thesistitle_checkstate=='F')
				 return "<font color='#33FF33'><label>专业负责人审核通过</label></font>";
				 if(row.thesistitle_checkstate=='G')
				 return "<font color='#FF8800'><label>教务审核未通过</label></font>";
				 if(row.thesistitle_checkstate=='H')
				 return "<font color='#33FF33'><label>教务审核通过</label></font>";
				 if(row.thesistitle_checkstate=='I')
				 return "<font color='#F00'><label>状态I</label></font>";
				}
			},
			 {
				field : 'thesistitle_tchmemo',
				title : '意见',
				width : 100,
				formatter : function(value, row, index) {
			     return "<a onclick=show("+index+")><font color='#F00'>查看</font></a>";
				}
			},
			{
			field : 'edit',
				title : '课题修改',
				width : 100,
					formatter : function(value, row, index) {
					if(row.thesistitle_select_way=='A')//学生申报且未审核之前可以修改
					{
					if(row.thesistitle_checkstate=='A'||row.thesistitle_checkstate=='B'||row.thesistitle_checkstate=='E'||row.thesistitle_checkstate=='G')//学生申报且未审核之前可以修改
				 return "<a onclick=openeditpanle("+index+")><font color='#FF8800'>修改</font></a>";
				// return "<button  type='button' class='btn btn-success btn-bg' onclick=openeditpanle("+index+")/>修改</button>";
				  else return "<a><font color='#FF8800'>不可修改</font></a>";
				  }else
				  return "<a><font color='#FF8800'>不可修改</font></a>";
				//if(row.thesistitle_select_way=='A'&&row.thesistitle_checkstate=='A')//学生申报且未审核之前可以修改
				//     return "<a onclick=openeditpanle("+index+")>修改</a>";
				//     if(row.thesistitle_select_way=='A'&&row.thesistitle_checkstate=='B')//学生申报且未审核之前可以修改
			//     return "<a onclick=openeditpanle("+index+")>修改</a>";
				//     if(row.thesistitle_select_way=='A'&&row.thesistitle_checkstate=='E')//学生申报且未审核之前可以修改
				//     return "<a onclick=openeditpanle("+index+")>修改</a>";
				 //    if(row.thesistitle_select_way=='A'&&row.thesistitle_checkstate=='G')//学生申报且未审核之前可以修改
				 //    return "<a onclick=openeditpanle("+index+")>修改</a>";
				//return "<a>不可修改</a>";
			//onclick="$('#dlg').dialog('open')
				}
			} ] ]

		});
		
	});
	//-------------xxxxxxxxxxxxx
		function show(index){
     //alert(index);
     var rows = $("#stuOwnDis").datagrid("getRows"); 
         var traget=document.getElementById("teacherComent");
         if(rows[index].thesistitle_tchmemo==null)
         traget.value="无记录";
            else  traget.value=rows[index].thesistitle_tchmemo;
             var traget_div=document.getElementById("teacherComent_div");
           //  alert(traget_div.style.display);
            if(traget_div.style.display=="none")
             traget_div.style.display="block";
           else if(traget_div.style.display=="block")
             traget_div.style.display="none";
    }
	//--------------xxxxxxxxxxxxxx
	select=function(index){
		var row=$('#stuDis').datagrid('getSelected');
		if(row){
		if(row.thesistitle_checkstate=="B")
		{$.messager.confirm('系统提示','您确定要选中此题目吗?',function(r){
		if(r){
		$.post('<%=request.getContextPath()%>/StuSelectDis',{id:row.thesistitle_id},function(result){
		stuOwnDis.datagrid("reload");
		stuDis.datagrid("reload");
		if(result.success==true)
		$.messager.alert("系统提示","已成功选取");
		else
		$.messager.alert("系统提示","选取失败");

		},'json');
		}
		});}
		}
			};

function openeditpanle(index){
 var rows=$("#stuOwnDis").datagrid("getRows");
 //alert(index);
 var row=rows[index];
 //alert(row.thesistitle_name);
 //alert(row.thesistitle_id);
 var traget=document.getElementById("thesistitle");
     traget.value=row.thesistitle_name;
     traget=document.getElementById("thesisid");
     traget.value=row.thesistitle_id;
$('#dlg').dialog('open');

}

function submitForm(){
        $('#dlg').dialog('close');
         var thesistitle=$('#thesistitle').val();
		  $('#ff').form({
    						url:'<%=request.getContextPath()%>/StuEditDis',
    						onSubmit: function(){
    						//进行表单验证
    						//如果返回false阻止提交
    						if(thesistitle==null||thesistitle=="")
					        { 
					         $.messager.alert('提示','所有框不能为空！');
							  return false;
							}
    							},
    						success:function(data){
    						if(data=='true')
    						$.messager.alert('提示',"修改成功");
    						if(data=='false')
    						$.messager.alert('提示',"修改失败");
    						$("#stuOwnDis").datagrid("reload");  //重新加载  
    						}
    						});
    						//提交表单
    						$('#ff').submit();

			}
//后台人员代码-----结束--------------------------------------------------
</script>

</head>

<body>
<!--全局框架 开始 conteiner-->
<div class="container"> 
  <!--标题头图片-->
  <div class="row">
    <div class="body_top"> <img src="img/head.png" align="center" width="1280px"/> </div>
  </div>
  <!--全局12栅格 规划全局区域图线 开始 row+ col-->
  <div class="row">
  <jsp:include page="stu_siderbar.jsp"></jsp:include>
  <!--右侧用户操作模块 占全局9栅格-->
        <div class="col-xs-9"style="border:2px solid #25465d">
          <div class="row">
            <div class="col-xs-5 xs11" style="margin-bottom:0px; margin-top:5px;"> <strong><font size="3">流程管理》选择课题</font></strong> </div>
            <div class="col-xs-5 xs11" id="right" style="margin-bottom:0px; margin-top:5px;" >
              <p><b><font size="3">毕业设计流转状态：&nbsp;&nbsp;&nbsp;开题阶段</p>
              </b></font> </div>
          </div>
          <div class="row">
            <div class="col-xs-11  xs11" style="margin-bottom:0px; margin-top:5px;">
              <div class="panel panel-default" >
                <div class="panel-heading" align="left"> <a data-toggle="collapse" data-parent="#accordion"  href="#collapseHelp" class="glyphicon glyphicon-chevron-down"> 操作指南 </a> </div>
                <div id="collapseHelp" class="panel-collapse collapse">
                  <div class="panel-body"> 论文题目由学生申报题目与教师提交题目合成作为学生论文的选取题目：
                    <ul>
                      <li>学生一般可以申报两个题目，最后确定一个项目，另一个题目可以作为选题库储备题目，教师一般可以提交5个题目左右，作为学生选题使用，在指导</li>
                      <li>教师审核通过后，将论文题目作为开题报告的论文题目，论文题目在指导教师审核阶段可以进行修改，当申报的题目在专业负责人审批通过后，将不可以修改了。</li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <br/>
         
          <div class="row" >
          <!--后台人员的表格一 开始  -->
            <div class="col-xs-11 xs11 table-responsive" style="margin-top:0px; margin-bottom:0px;height:200px">
              
              <table id="stuDis"></table>
           
            </div>
          <!--后台人员的表格一结束  -->
          </div>
          <br/>
          <br/>
          <div class="row">
            <div class="col-xs-11 xs11"id="xs9"style="margin-top:5px;height:100px">
            <table id="stuOwnDis"></table>
            </div>
          </div>
                     <!-- 后台人员代码开始 -->
         <div class="row" align="center">
                <div class="col-xs-11  xs11" style="margin-top:5px; margin-bottom:0px;">
                   <div  id="teacherComent_div" class="panel-body" style="display:none">
                   <h4 align="left">指导教师审核意见</h4>
                         <textarea id="teacherComent" class="form-control" rows="3" readonly="readonly" ></textarea>
                   </div> 
               </div> 
     </div> 
            <!--后台人员代码结束  -->
        </div>
      </div>
      <!--修改结束--> 
      
      <!--全局12栅格 规划全局区域图线 结束 row+ col--> 
    </div>
  </div>
  <div class="row" style="background-color:#25465d"">
    <p  align="center" style="color:white;background-color:#25465d"><strong>用户单位：</strong>吉林大学珠海学院&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>版权所有：</strong>吉林大学珠海学院计算机科学与技术系</p>
  </div>
  <!--全局框架开始 conteiner--> 
</div>
<!-- 课题修改对话框 -->
    <div id="dlg">
			<form id="ff" action="form" method="post">
              <input class="easyui-validatebox" type="text" name="thesistitle" id="thesistitle"
							data-options="required:true"></input>
				<input type="hidden" name="thesisid" id="thesisid"/>
			  <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">提交</a> 
			</form>
	</div>

<!-- 课题修改对话框 -->
</body>
</html>